//
//  CollectionViewCell13.m
//  BLDMusics
//
//  Created by lxd on 16/3/28.
//  Copyright © 2016年 李晓丹. All rights reserved.
//

#import "CollectionViewCell13.h"

@interface CollectionViewCell13 ()

@property (nonatomic, strong) UILabel *reasonLabel;

@property (nonatomic, strong) UILabel *nameLabel;

@property (nonatomic, strong) UIImageView *imag1;

@property (nonatomic, strong) UIImageView *imag2;

@property (nonatomic, strong) UIImageView *imag3;

@property (nonatomic, strong) UIImageView *imag4;

@property (nonatomic, strong) UIImageView *imag5;

@property (nonatomic, strong) UIImageView *imag6;

@end

@implementation CollectionViewCell13

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self createControls];
    }
    return self;
}


- (void)createControls {
    
    self.reasonLabel = [[UILabel alloc] init];
    [self.contentView addSubview:_reasonLabel];
    
    self.nameLabel = [[UILabel alloc] init];
    [self.contentView addSubview:_nameLabel];
    
    self.imag1 = [[UIImageView alloc] init];
    [self.contentView addSubview:_imag1];
    
    self.imag2 = [[UIImageView alloc] init];
    [self.contentView addSubview:_imag2];
    
    self.imag3 = [[UIImageView alloc] init];
    [self.contentView addSubview:_imag3];
    
    self.imag4 = [[UIImageView alloc] init];
    [self.contentView addSubview:_imag4];
    
    self.imag5 = [[UIImageView alloc] init];
    [self.contentView addSubview:_imag5];
    
    self.imag6 = [[UIImageView alloc] init];
    [self.contentView addSubview:_imag6];
}


- (void)layoutSubviews {
    
    [super layoutSubviews];
    
    self.backgroundColor = [UIColor colorWithRed:205 / 255.0 green:205 / 255.0 blue:205 / 255.0 alpha:0.2];
    
    _reasonLabel.frame = CGRectMake(0, 5, self.bounds.size.width, 20);
    _reasonLabel.textAlignment = NSTextAlignmentCenter;
    _reasonLabel.font = [UIFont systemFontOfSize:14];
    
    _nameLabel.frame = CGRectMake(0, 35, self.bounds.size.width, 25);
    _nameLabel.textAlignment = NSTextAlignmentCenter;
    
    
    CGFloat width = self.bounds.size.width / 3;
    
    _imag1.frame = CGRectMake(0, self.bounds.size.height - 2 * width, width, width);
    
    _imag2.frame = CGRectMake(width, self.bounds.size.height - 2 * width, width, width);
    
    _imag3.frame = CGRectMake(2 *width, self.bounds.size.height - 2 * width, width, width);
    
    _imag4.frame = CGRectMake(0, self.bounds.size.height - width, width, width);
    
    _imag5.frame = CGRectMake(width, self.bounds.size.height - width, width, width);
    
    _imag6.frame = CGRectMake(2 *width, self.bounds.size.height - width, width, width);
    

}


- (void)setModel:(LXDLayoutModel *)model {
    _model = model;
    [self signControls];
}


- (void)signControls {
    
    _reasonLabel.text = self.model.reason;
    
    _nameLabel.text = self.model.name;
    
    [_imag1 sd_setImageWithURL:[NSURL URLWithString:self.model.smallPicUrls[0]]];
    
     [_imag2 sd_setImageWithURL:[NSURL URLWithString:self.model.smallPicUrls[1]]];
    
     [_imag3 sd_setImageWithURL:[NSURL URLWithString:self.model.smallPicUrls[2]]];
    
     [_imag4 sd_setImageWithURL:[NSURL URLWithString:self.model.smallPicUrls[3]]];
    
     [_imag5 sd_setImageWithURL:[NSURL URLWithString:self.model.smallPicUrls[4]]];
    
     [_imag6 sd_setImageWithURL:[NSURL URLWithString:self.model.smallPicUrls[5]]];
    
    
}


@end
